home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
MACD 5
/
MACD 5.bin
/
internet
/
yam_i_dodatki
/
yamtools1.7
/
ytdelete.rexx
< prev
next >
Wrap
OS/2 REXX Batch file
|
1997-06-29
|
13KB
|
350 lines
/******************************************************************************/
/* */
/* YTDelete */
/* Copyright ©1997 by Dick Whiting */
/* */
/*----------------------------------------------------------------------------*/
/* This script requires YAMTOOLS for it to work. If you don't have YAMTOOLS */
/* you can get it on Aminet in directory comm/mail. This script allows you */
/* to Delete all selected mail. This is only really useful from */
/* the mail list of a SEARCH. Otherwise, use YAM's normal capabilities. */
/* */
/*----------------------------------------------------------------------------*/
/* */
/* Standard Disclaimer: I wrote it, it works for me, I don't guarantee */
/* that it will do anything productive for anyone else, etc. etc. ;-) */
/* */
/*HOWEVER, if you DO find a use for it: I homeschool my kids and they */
/*would love a postcard from where EVER you live. */
/* */
/*Instant GEOGRAPHY lesson;) */
/* */
/* */
/*POSTCARDS: Dick Whiting */
/* 28590 S. Beavercreek Rd. */
/* Mulino, Oregon 97042 */
/* USA */
/* */
/*----------------------------------------------------------------------------*/
/* */
/* Address Bug Reports or Comments to: */
/* Dick Whiting <dwhiting@europa.com> */
/* 15 June 1997 */
/* */
/******************************************************************************/
/*
$VER: 1.1 Copyright ©1997 by Dick Whiting
$AUTHOR: Dick Whiting
$DESCRIPTION: Deleter for use with YAMTOOLS
*/
options results
options failat 9999 /* keep maildelete return from showing */
/**************************************************************************/
/* Initialize Variables */
/**************************************************************************/
Call MUIvars /* go define vars for MUI use */
Call YTvars /* various values used in YT */
Call Helpvars /* pointers into HELP guide */
Call Localize /* vars for localizing strings*/
Call Builtvars /* built using previous values*/
Address YAMTOOLS
Call CheckYam
Call CheckMailList
Call ProcessDeletes
exit
/**************************************************************************/
/* Check that there is some mail to process */
/**************************************************************************/
CheckMailList:
list ID MLST ATTRS MUIA_List_Entries
mcnt=result
if mcnt=0 then do
errmsg=_text._nomail
Call ErrorMsg
end
Return
/**************************************************************************/
/* Process Deletes */
/**************************************************************************/
ProcessDeletes:
request ID VERD GADGETS _text._ok||'|'||_text._cancel _text._delreq
if result=0 then exit
infotitle=_title._info
infotext='\033n'||_text._delmail
infobuttons='"'||_text._squit1||comma||_text._squit2||comma||_text._squit3||'"'
showbusy=TRUE
Call InfoWindow
list ID MLST ATTRS MUIA_List_Entries
mcnt=result
Deletelist.=missing
Deletelist.0=0
Updlist.=missing
Updlist.0=0
acnt=0
do i=0 to mcnt-1
list ID MLST
mline=result
if mline='' then break
parse var mline arch ',' from ',' subj ',' mfor ',' mnum ',' anum ',' file
acnt=acnt+1
anum=right(anum,6,'0')
mnum=right(mnum,6,'0')
Deletelist.0=acnt
Deletelist.acnt=anum mnum file subj
radio ID SQUIT
if result~=_text._squit1 then leave
end
Updlist.0=Deletelist.0
if acnt=0 then do
errmsg=_text._nomail
Call ErrorMsg
end
if show('L','rexxtricks.library') then do /* use tricks library */
call QSORT(Deletelist) /* sort by name, line number */
end
else do /* use QuickSort format */
call QSORT(1, Deletelist.0, Deletelist) /* sort by name, number */
end
do i=Deletelist.0 to 1 by -1 /* process in reverse order */
anum=word(Deletelist.i,1)
anum=strip(anum,'L','0')
if anum='' then anum=0
mnum=word(Deletelist.i,2)
mnum=strip(mnum,'L','0')
if mnum='' then mnum=0
file=word(Deletelist.i,3)
subj=subword(Deletelist.i,4)
Updlist.i=anum
Updlist.i.1=mnum
Updlist.i.1.1=file
Updlist.i.1.1.1=subj
Address YAM 'setfolder 'anum /* goto folder */
Address YAM 'setmail 'mnum /* set to mail */
Address YAM "getmailinfo file" /* verify filename */
xfile=result
xlen=length(file)
xfile=right(xfile,xlen)
Address YAM "getmailinfo subject" /* verify subject */
xsubj=result
xsubj=translate(xsubj,' ',',')
if file~=xfile | xsubj~=subj then do
Updlist.i.1.1.1.1=bo||_text._error
end
else do
Updlist.i.1.1.1.1=bo||_text._deleted
Address YAM "maildelete"
end
end
do i=1 to Updlist.0
do j=0 to mcnt-1
list ID MLST POS j
mline=result
if mline='' then break
parse var mline arch ',' from ',' subj ',' mfor ',' mnum ',' anum ',' file
if Updlist.i=anum & Updlist.i.1=mnum then do
arch=Updlist.i.1.1.1.1
mline=arch||','||from||','||subj||','||mfor||','||mnum||','||anum||','||file
list ID MLST POS j STRING mline
iterate i
end
end
end
window ID YTINF CLOSE
Return
/**************************************************************************/
/* Make sure YAM and YAMTOOLS are running. Show YAM. */
/**************************************************************************/
CheckYAM:
if ~show('p','YAMTOOLS') then do
errmsg=_text._noyt
say errmsg
exit
end
if ~show('p','YAM') then do
errmsg=_text._noyam
Call ErrorMsg
exit
end
Address YAM 'show' /* uniconify YAM's screen */
Address YAM 'info SCREEN' /* get YAM's screen */
screen=result
if screen='' then screen='Workbench'
Return
/******************************************************************************/
/* Display ERROR message and EXIT. */
/******************************************************************************/
ErrorMsg:
window ID YTINF CLOSE
request ID ERRM GADGETS _text._ok errmsg
exit
Return
/******************************************************************************/
/* Simple information/error message window. */
/******************************************************************************/
InfoWindow:
window ID YTINF TITLE _title._info ATTRS MUIA_Window_PublicScreen screen,
MUIA_Window_SizeGadget FALSE,
MUIA_Window_DepthGadget FALSE
group
group
text ID STEXT HELP help.STEXT NODE node.STEXT LABEL infotext
endgroup
if showbusy then do
group
object CLASS '"Busy.mcc"' ATTRS MUIA_VertWeight 25
endgroup
end
if infobuttons ~='' then do
group HORIZ
group
space HORIZ
endgroup
group
radio ID SQUIT HELP help.SQUIT NODE node.SQUIT LABELS infobuttons
endgroup
group
space HORIZ
endgroup
endgroup
end
else do
group
space HORIZ 100
endgroup
end
endgroup
endwindow
Return
/******************************************************************************/
/* MUIREXX TAGS & VARIABLES */
/******************************************************************************/
Muivars:
MUIA_List_Entries = 0x80421654
MUIA_VertWeight = 0x804298d0
MUIA_Window_DepthGadget = 0x80421923
MUIA_Window_PublicScreen = 0x804278e4
MUIA_Window_SizeGadget = 0x8042e33d
TRUE=1
FALSE=0
Return
/**************************************************************************/
/* Various values used throughout the various routines */
/**************************************************************************/
YTvars:
missing='.'
bo='\033b' /* print control BOLD */
Return
/**************************************************************************/
/* Messages, text, etc. constructed using previously defined values */
/**************************************************************************/
Builtvars:
Return
/**************************************************************************/
/* Pointers into the YamTools.guide documentation */
/**************************************************************************/
Helpvars:
node.SQUIT=''
node.STEXT=''
Return
/**************************************************************************/
/* Mui Gadgets, text, msgs, etc. used in YamTools */
/**************************************************************************/
Localize:
/*********************************/
/* Miscellaneous info strings */
/*********************************/
_title._main='"YTReFormat v1.0"' /* main screen title */
_title._info='"YTDelete Info"' /* default title on infomsg */
_text._ok='Ok' /* various OK buttons */
_text._cancel='Cancel' /* LABEL for CANCEL button */
_text._squit1='Continue' /* CONTINUE option on infowin */
_text._squit2='Interrupt' /* INTERRUPT option on infowin*/
_text._squit3='Abort' /* ABORT option on infowin */
_text._error='error' /* error on deleting mail */
_text._deleted='Deleted' /* indicate mail deleted */
_text._delmail='Deleting Mail...' /* Deleting Mail message */
_text._delreq='"Delete selected entries?"' /* delete request message */
/*********************************/
/* Various error conditions */
/*********************************/
_text._noyam='You need YAM running to use YTDelete' /* yam not running */
_text._noyt='You need YAMTOOLS running to use YTDelete' /* no yamtools */
_text._nomail='You need to CHOOSE mail to Delete'
Return
/**************************************************************************/
/* Help Messages to display with MUI bubble facility. */
/* */
/* Format is simple: help.ID where ID is the id specified on the MUI */
/* object statement. */
/* Similar approach for accessing the .guide information using the NODE */
/* option on the object statement. */
/* */
/**************************************************************************/
help.SQUIT=''
help.STEXT=''
Return